﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataBaseImage.ascx.cs"
    Inherits="Tizer.Web.Backoffice.Controls.DataBaseImage" %>
<script type="text/javascript">
    $(document).ready(function () {
    <%if(this.FullImageInModal){ %>
       $("a#fancybox_<%=this.ID %>").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
        'onComplete'    :   function(){onComplite<%=this.ID %>();}
	    });
        <%} %>
    });

    var isFirst<%=this.ID %> = true;
    function setSrc<%=this.ID %>() {
        
        var fancyImg = document.getElementById("fancyImage_<%=this.ID %>");
        if (fancyImg != null) {
            fancyImg.setAttribute('src', "../../HttpHandlers/ImageProcessor.ashx?id=<%=this.ImageId %>&width=0&height=0");     
        }
    }

    function onComplite<%=this.ID %>(){
        if(isFirst<%=this.ID %>){
            isFirst<%=this.ID %> = false;
            $("#fancybox_<%=this.ID %>").trigger('click');
        }
    }


</script>
<a id="fancybox_<%=this.ID %>" class="fancybox" href="#data_<%=this.ID %>" onclick='setSrc<%=this.ID %>();'>
    <asp:Image ID="DBImage" runat="server" AlternateText="image" /></a>
<div style="display: none">
    <div id="data_<%=this.ID %>">
        <img id="fancyImage_<%=this.ID %>" alt="image" /></div>
</div>
